﻿Public Class SHA1
    Function mySHA(ByVal SourceStr As String) As String 'SHA1加密算法
        Dim SHA As New System.Security.Cryptography.SHA1CryptoServiceProvider 'sha1加密
        'Dim sha As New System.Security.Cryptography.SHA256Managed’sha256加密
        'Dim sha As New System.Security.Cryptography.SHA512Managed ‘sha512加密
        Dim bytValue() As Byte '输入
        Dim bytHash() As Byte '输出
        bytValue = System.Text.Encoding.UTF8.GetBytes(SourceStr & "6yh1523w") '输入字符转为byte
        bytHash = SHA.ComputeHash(bytValue) '加密
        SHA.Clear()
        mySHA = Convert.ToBase64String(bytHash) '转为字符
    End Function
End Class
